<?php
namespace App\Models\System;
use Illuminate\Database\Eloquent\Model;

class BootModel extends Model
{
    public $table='live_boot';
    public $timestamps = false;

    public function getOnlineTimeAttribute($value)
    {
        $tmp = json_decode($value,true);
        krsort($tmp);
        return $tmp;
    }

    public static function getBootImgSetting(int $type=0) :array
    {
        $data = self::query();
        if ($type!==3){
            $data = $data->where('type','=',$type);
        }
        $data = $data->orderBy('sort','asc')->get()->toArray();
        return $data;
    }
}
